import genericApi from "@/util/genericApi.js";
const SERVICE_NAME = "order-api"; // 订单微服务名称
const BASE_URL = "/orders";

async function getOrders(params) {
    return genericApi.get(SERVICE_NAME, BASE_URL, params);
}
async function getOrderById(id) {
    return genericApi.get(SERVICE_NAME, `${BASE_URL}/${id}`);
}
async function createOrder(data) {
    return genericApi.post(SERVICE_NAME, BASE_URL, data);
}
async function updateOrder(data) {
    return genericApi.put(SERVICE_NAME, BASE_URL, data);
}
async function deleteOrder(ids) {
    const idsArray = Array.isArray(ids) ? ids : [ids];
    return genericApi.delete(SERVICE_NAME, `${BASE_URL}`, {}, idsArray);
}
export { getOrders, getOrderById, createOrder, updateOrder, deleteOrder }